﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Media;

namespace CPPEI.Coolzon.UI.DataPartLib
{
    public partial class DataChartBase
    {
        protected Visifire.Charts.PlotArea GetPlotArea()
        {
            Visifire.Charts.PlotArea plotArea = new Visifire.Charts.PlotArea();
            plotArea.Bevel = PlotAreaBevel;
            plotArea.BorderThickness = PlotAreaBorderThickness;
            plotArea.BorderColor = PlotAreaBorderColor==null? null : PlotAreaBorderColor.Brush;
            plotArea.Background = PlotAreaBackground == null ? new SolidColorBrush(Colors.Transparent) : PlotAreaBackground.Brush;
            plotArea.LightingEnabled = PlotAreaLightingEnable;
            plotArea.ShadowEnabled = PlotAreaShadowEnabled;

            return plotArea;
        }

        private bool plotAreaBevel;
        private Thickness plotAreaBorderThickness;
        private BrushEx plotAreaBorderColor;
        private BrushEx plotAreaBackground;
        private bool plotAreaLightingEnable;
        private bool plotAreaShadowEnabled;

        [Category("数据区域")]
        [DisplayName("数据区域是否斜切")]
        [Description("PlotAreaBevel")]
        [Editor(typeof(UI.XProperty.Editors.XBooleanEditor), typeof(UI.XProperty.XPropertyValueEditor))]
        [XProperty(XPropertyCategory.Other, "PlotAreaBevel", "是否斜切")]
        public bool PlotAreaBevel
        {
            get
            {
                return plotAreaBevel;
            }

            set
            {
                plotAreaBevel = value;
                Refresh();
            }
        }

        [Category("数据区域")]
        [DisplayName("数据区域边框大小")]
        [Description("PlotAreaBorderThickness")]
        [Editor(typeof(UI.XProperty.Editors.XThicknessEditor), typeof(UI.XProperty.XPropertyValueEditor))]
        [XProperty(XPropertyCategory.Other, "PlotAreaBorderThickness", "边框大小")]
        public Thickness PlotAreaBorderThickness
        {
            get
            {
                return plotAreaBorderThickness;
            }

            set
            {
                plotAreaBorderThickness = value;
                Refresh();
            }
        }

        [Category("数据区域")]
        [DisplayName("数据区域边框颜色")]
        [Description("PlotAreaBorderColor")]
        [Editor(typeof(UI.XProperty.Editors.XBrushEditor), typeof(UI.XProperty.XPropertyValueEditor))]
        [XProperty(XPropertyCategory.Other, "PlotAreaBorderColor", "边框颜色")]
        public BrushEx PlotAreaBorderColor
        {
            get
            {
                return plotAreaBorderColor;
            }

            set
            {
                plotAreaBorderColor = value;
                Refresh();
            }
        }

        [Category("数据区域")]
        [DisplayName("数据区域背景颜色")]
        [Description("PlotAreaBackground")]
        [Editor(typeof(UI.XProperty.Editors.XBrushEditor), typeof(UI.XProperty.XPropertyValueEditor))]
        [XProperty(XPropertyCategory.Other, "PlotAreaBackground", "背景颜色")]
        public BrushEx PlotAreaBackground
        {
            get
            {
                return plotAreaBackground;
            }

            set
            {
                plotAreaBackground = value;
                Refresh();
            }
        }

        [Category("数据区域")]
        [DisplayName("数据区域是否高亮")]
        [Description("PlotAreaLightingEnable")]
        [Editor(typeof(UI.XProperty.Editors.XBooleanEditor), typeof(UI.XProperty.XPropertyValueEditor))]
        [XProperty(XPropertyCategory.Other, "PlotAreaLightingEnable", "是否高亮")]
        public bool PlotAreaLightingEnable
        {
            get
            {
                return plotAreaLightingEnable;
            }

            set
            {
                plotAreaLightingEnable = value;
                Refresh();
            }
        }

        [Category("数据区域")]
        [DisplayName("数据区域是否显示阴影")]
        [Description("PlotAreaShadowEnabled")]
        [Editor(typeof(UI.XProperty.Editors.XBooleanEditor), typeof(UI.XProperty.XPropertyValueEditor))]
        [XProperty(XPropertyCategory.Other, "PlotAreaShadowEnabled", "是否显示阴影")]
        public bool PlotAreaShadowEnabled
        {
            get
            {
                return plotAreaShadowEnabled;
            }

            set
            {
                plotAreaShadowEnabled = value;
                Refresh();
            }
        }
    }
}
